﻿<Application x:Class="Strava1.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
             xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
             xmlns:sys="clr-namespace:System;assembly=mscorlib"
             xmlns:local="clr-namespace:Strava1">

    <!--Application Resources-->
    <Application.Resources>
        <local:MeterToKMConverter x:Key="MeterToKMConverter" />
        <local:MeterToFeetConverter x:Key="MeterToFeetConverter" />
        <local:MPSToMPHConverter x:Key="MPSToMPHConverter" />
        <local:CountMaxConverter x:Key="CountMaxConverter" />
        <local:SecondsToTimeConverter x:Key="SecondsToTimeConverter" />
        <local:SpeedConverter x:Key="SpeedConverter" />
        <local:JustIntConverter x:Key="JustIntConverter" />
        <local:RideSegmentPlacingsConverter x:Key="RideSegmentPlacingsConverter" />
        <local:SegmentStrokeConverter x:Key="SegmentStrokeConverter" />
        <local:TimeBehindLeaderConverter x:Key="TimeBehindLeaderConverter" />
        <local:textConv x:Key="textConv" />

        <LinearGradientBrush x:Key="RideProfileFill"
                             StartPoint="0,0"
                             EndPoint="0,1">
            <GradientStop Offset="0"
                          Color="#AA892700" />
            <GradientStop Offset="1"
                          Color="#30892700" />
        </LinearGradientBrush>
        <LinearGradientBrush x:Key="SegmentProfileFill"
                             StartPoint="0,0"
                             EndPoint="0,1">
            <GradientStop Offset="0"
                          Color="#AAFF0000" />
            <GradientStop Offset="1"
                          Color="#30FF0000" />
        </LinearGradientBrush>

        <Style TargetType="ListBoxItem">
            <!--<Setter Property="Foreground"
                    Value="{StaticResource PhoneAccentBrush}" />-->
            <Setter Property="HorizontalContentAlignment"
                    Value="Stretch" />
        </Style>

        <ControlTemplate x:Key="PhoneSimpleRepeatButton"
                         TargetType="RepeatButton">
            <Rectangle Fill="Transparent" />
        </ControlTemplate>
        <ControlTemplate x:Key="SliderThumbTemplate"
                         TargetType="Thumb">
            <Border Background="Green">
                <Rectangle Fill="{StaticResource PhoneAccentBrush}"
                           HorizontalAlignment="Center"
                           Width="1" />
            </Border>
        </ControlTemplate>

        <Style x:Key="ProfileSliderStyle"
               TargetType="Slider">
            <Setter Property="Margin"
                    Value="0" />
            <Setter Property="Padding"
                    Value="0" />
            <Setter Property="BorderThickness"
                    Value="0" />
            <Setter Property="BorderBrush"
                    Value="Transparent" />
            <Setter Property="Maximum"
                    Value="10" />
            <Setter Property="Minimum"
                    Value="0" />
            <Setter Property="Value"
                    Value="0" />
            <Setter Property="Background"
                    Value="#20FF0000" />
            <Setter Property="Foreground"
                    Value="#2000FF00" />
            <Setter Property="HorizontalAlignment"
                    Value="Stretch" />
            <Setter Property="VerticalAlignment"
                    Value="Stretch" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="Slider">
                        <Grid Background="Transparent">
                            <Grid x:Name="HorizontalTemplate"
                                  Margin="{StaticResource PhoneHorizontalMargin}">
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto" />
                                    <ColumnDefinition Width="0" />
                                    <ColumnDefinition Width="*" />
                                </Grid.ColumnDefinitions>
                                <Rectangle x:Name="HorizontalTrack"
                                           Grid.ColumnSpan="3"
                                           Fill="{TemplateBinding Background}"
                                           IsHitTestVisible="False" />
                                <Rectangle x:Name="HorizontalFill"
                                           Grid.Column="0"
                                           Fill="{TemplateBinding Foreground}"
                                           IsHitTestVisible="False" />
                                <RepeatButton x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                              Grid.Column="0"
                                              IsTabStop="False"
                                              Template="{StaticResource PhoneSimpleRepeatButton}" />
                                <RepeatButton x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                              Grid.Column="2"
                                              IsTabStop="False"
                                              Template="{StaticResource PhoneSimpleRepeatButton}" />
                                <Thumb x:Name="HorizontalThumb"
                                       Background="Orange"
                                       Grid.Column="1"
                                       RenderTransformOrigin="0.5,0.5"
                                       Width="31">
                                </Thumb>
                            </Grid>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>

    </Application.Resources>

    <Application.ApplicationLifetimeObjects>
        <!--Required object that handles lifetime events for the application-->
        <shell:PhoneApplicationService Launching="Application_Launching"
                                       Closing="Application_Closing"
                                       Activated="Application_Activated"
                                       Deactivated="Application_Deactivated" />
    </Application.ApplicationLifetimeObjects>

</Application>